<template>
	<view class="indexs">
		<view class="header header_wi" :style="'padding-top: ' + navH + 'px;'">
			<view class="header_height" :style="'height:' + gaodu + 'px;line-height:' + gaodu + 'px;top:' + gaodutops + 'px;'">
				<view class="index_h_cont3">
					<view class="index_wenben_img" @tap="jumpzuo"><image :src="imgUrl + '/dzx_img33.png'" mode="widthFix"></image></view>
					<view class="index_wenben">{{ type == 0 ? $t('page_my_jinyun.newbie_question') : $t('page_my_jinyun.Prohibited_goods') }}</view>
				</view>
			</view>
			<view class="coloe_title">s</view>
		</view>
		
		<view class="index_center" :style="'padding-top:' + (navH + 50) + 'px;'">
			<view class="my_jinyun_center">
				<view class="my_jinyun_list" v-if="setting.newhand_mode == 10">
					<view class="my_jinyun_cont" @tap="tiaozhuanlianjie" :data-id="item.article_id" v-for="(item, index) in arrlist" :key="index">
						<image :src="imgUrl + '/dzx_img172.png'"></image>
						<text>{{ item.article_title }}</text>
					</view>
				</view>
				<view class="my_jinyun_list" v-if="setting.newhand_mode == 20">
					<view class="my_jinyun_cont_new" @tap="tiaozhuanlianjie" :data-id="item.article_id" v-for="(item, index) in arrlist" :key="index">
						<text>{{ item.article_title }}</text>
						<image mode="scaleToFill" :src="item.image.file_path"></image>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
// pages/shouye/shouye_zkc/shouye_zkc.js
const app = getApp();

let request = require('../../../utils/require');

export default {
	data() {
		return {
			navH: app.globalData.navHeight,
			gaodu: app.globalData.height,
			gaodutops: app.globalData.top,
			imgUrl: app.globalData.imgUrl,
			setting: uni.getStorageSync('setting'),
			//分页
			page: 1,
			ispage: true,
			arrlist: [],
			type: 0 //新手问题，1是禁运物品
		};
	},
	/**
	 * 生命周期函数--监听页面加载
	 */ 
	onLoad(options) {
		var that = this;
		that.type = options.type
		that.xinshouwenti();
	},
	onShow() {
		console.log(this.setting)
		var that = this;
	},
	/**
	 * 生命周期函数--监听页面初次渲染完成
	 */
	onReady: function() {},
	/**
	 * 生命周期函数--监听页面隐藏
	 */
	onHide: function() {},
	/**
	 * 生命周期函数--监听页面卸载
	 */
	onUnload: function() {},
	/**
	 * 页面相关事件处理函数--监听用户下拉动作
	 */
	onPullDownRefresh: function() {},
	/**
	 * 页面上拉触底事件的处理函数
	 */
	onReachBottom: function() {
		console.log(this.ispage, 5454);
		if (this.ispage) {
			this.page = this.page + 1
			this.xinshouwenti();
		}
	},
	/**
	 * 用户点击右上角分享
	 */
	onShareAppMessage: function() {},
	methods: {
		//新手问题
		xinshouwenti() {
			var that = this;
			var url = '';

			if (that.type == 0) {
				//新手问题
				url = 'index.php?s=/api/page/problem';
			} else {
				//禁运物品
				url = 'index.php?s=/api/page/ban';
			}

			var data = {
				token: uni.getStorageSync('token'),
				page: that.page
			};
			request.post(url + `&wxapp_id=` + uni.getStorageSync('web_id'), data).then(res => {
				console.log(res.data.data.last_page, 89888);
				if (res.data.code == 1) {
					if (that.page > res.data.data.last_page) {
						that.ispage = false
					} else {
						that.arrlist = that.arrlist.concat(res.data.data.data)
					}
				}
			});
		},

		tiaozhuanlianjie(e) {
			uni.navigateTo({
				url: '/pages/mys/my_jinyun_details/my_jinyun_details?id=' + e.currentTarget.dataset.id
			});
		},

		jumpzuo() {
			uni.navigateBack();
		}
	}
};
</script>
<style>
@import './my_jinyun.css';
</style>
